package com.imooc.springcloudstreamtest.controller;

import com.imooc.springcloudstreamtest.message.StreamClient;
import com.imooc.springcloudstreamtest.pojo.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.messaging.support.MessageBuilder;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: 阿俊哥
 * @Date: 2019/6/15 15:32
 * @Version 1.0
 */
@RestController
public class TestStreamController {

    @Autowired
    StreamClient streamClient;

    @RequestMapping("/sendMessage")
    public void sendMessage(){
        Person person = new Person("zhangsan", 16);
        streamClient.output().send(MessageBuilder.withPayload(person).build());
    }
}
